﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using control.Biz;

namespace control
{
    
    public partial class frmThongketonkho : Form
    {
        List<BizTonKho> tonkhos = new List<BizTonKho>();
        public frmThongketonkho()
        {
            InitializeComponent();
        }

        private void button_XemTK_Click(object sender, EventArgs e)
        {
            if (txt_SP.Text.Trim() == "")
            {
                errorProvider1.SetError(txt_SP, "chưa nhập sách");
            }
            else
            {
                string Sach = txt_SP.Text;
                DateTime fromDate = datetp_Batdau.Value;
                DateTime toDate = dateTP_ngayKT.Value;
                tonkhos = BizTonKho.Find(Sach, fromDate, toDate);
                dataGridView1.DataSource = null;
                dataGridView1.DataSource = tonkhos;
            }
        }

        private void frmThongketonkho_Load(object sender, EventArgs e)
        {
            dataGridView1.AutoGenerateColumns = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            frmChon frm = new frmChon();
            frm.ShowDialog();
            txt_SP.Text = frm.Selected.MaSach;
        }

    }
}
